package org.come.Jpanel;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.swing.*;

import com.gl.util.Xy2Util;
import com.tool.btn.*;
import org.come.action.petpaixu.MyRenderer;
import org.come.action.petpaixu.PetpxJframe;
import org.come.action.petpaixu.PetpxJpanel;
import org.come.bean.AllPet;
import org.come.bean.ConfigureBean;
import org.come.bean.LoginResult;
import org.come.entity.RoleSummoning;
import org.come.model.Configure;
import org.come.mouslisten.PetJlistChoseMouslisten;
import org.come.mouslisten.PointChangeMouslisten;
import org.come.mouslisten.WLLMouslisten;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.ScrollUI;
import org.come.until.SrcollPanelUI;
import org.come.until.UserMessUntil;
import org.soaring.btn.CharacterBtn;

import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;
import com.tool.tcp.NewPart;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;



/**
 * @author 郑吉利
 * @date : 2017年11月22日 下午10:26:40
 */

public class TestPetJpanel extends JPanel implements MouseListener {
    private ImageIcon icon;
    private static TestPetJpanel testPetJpanel;
    // 召唤兽列表
    private static JList<String> listpet;
    // 列表中的对象
    private static DefaultListModel<String> listModel;// 放置召唤兽的对象
    // 列表中对象的名字颜色
    private Color fontcolor;
    private Color niubikelas;
    // 滚动条
    private JScrollPane jScrollPane;
    private int level;
    // 召唤兽名称
    private static JTextField labname;
    private GoodPanelBtn btnchangepwd;
    private static JLabel lablevel,// 放置召唤兽等级
            labloyalty// 放置召唤兽忠诚
            , labclose // 放置召唤兽亲密
            , labHP, labMP, labAP, labSP, labCP, labEXP, labEXPImg// HP、MP、AP、SP、禅定、 EXP
            , labrootbone// 根骨输入框
            , labintelligence// 灵性输入框
            , labpower// 力量输入框
            , labspeed// 敏捷输入框
            , labconcentrate // 定力输入框
            , labpointnumber;// 可分配点数输入框
    private static JLabel changeImg;
    //    private DeleteSkillBtn supportListBtn;// 排序
    private PetPanelBtn btnpetnamech, // 更改召唤兽名字按钮
            lingxi, // 灵犀按钮
            btnwar, // 参战按钮
            btnpetgk,//召唤兽跟随
            btnpetyc, //召唤兽跟随
            btnpalPet,
            btnlh,
            btnjp,
            supportListBtn// 排序
            // , btnrest// 召唤兽休息按钮
            , btnaddlittle// 召唤兽加点按钮
            , btndomesticated// 召唤兽驯养按钮
            , btnpetkills// 召唤兽技能按钮
            , btnpetarticles// 召唤兽物品按钮
            , btnsmeltmonster// 炼妖按钮
            , btnrelease// 放生按钮
            , btnRolequality// 抗性按钮
            , btnpetcun, btnpetyqu, btnsummon;// 召唤按钮
    private GoodAndPetLockBtn btnlock, // 召唤兽加锁按钮
            btnunlock, btnTime;// 召唤兽解锁按钮
    private static JLabel petsum;// 召唤兽数量
    private JTextArea area;
    private static NeidanBtn[] labNedan = new NeidanBtn[100];// 放置内丹的四个小框框
    private final CharacterBtn[] dians = new CharacterBtn[10];
    //public static JLabel labgundong = new JLabel(new ImageIcon("inkImg/hongmu/soaring/滚动条w18,h100px.png"));
    final ImageIcon imageIcon = new ImageIcon("img/123_副本.png");
    /**
     * 字段名:warNum 参战位数<br>
     */
    private static int warNum = -1;

    // 使用WeakReference避免内存泄漏
    private WeakReference<PetJlistChoseMouslisten> petJlistChoseMouslistenRef;
    private WeakReference<PointChangeMouslisten>[] pointChangeMouslistenRefs;

    public TestPetJpanel() throws Exception {
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));
        if (MyIsif.getStyle().equals("水墨UI")) {
            this.add(this.getChangeImg());
            testPetJpanel = this;
            this.setPreferredSize(new Dimension(393, 490));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            this.setLayout(null);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 6);
            offBtn.setBounds(393 - 37, 10, 25, 25);
            this.add(offBtn);
            listModel = new DefaultListModel<String>();
            // 召唤兽列表
            listpet = new JList<String>() {
                {
                    setOpaque(false);
                } // instance initializer
            };
            listpet.setSelectionBackground(new Color(33, 42, 52));
            fontcolor = Color.white;// 203,181,91
            listpet.setSelectionForeground(fontcolor);
            listpet.setForeground(fontcolor);
            listpet.setFont(new Font("微软雅黑", 1, 14));
            listpet.setBackground(UIUtils.Color_BACK); // 设置列表框为透明背景
            listpet.setModel(listModel);
            listpet.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            DefaultListCellRenderer renderer = new DefaultListCellRenderer() {
                Color color = new Color(203, 181, 91);

                @Override
                public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
                                                              boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (warNum == index) {
                        this.setForeground(color);
                    } else {
                        this.setForeground(Color.white);
                    }
                    return this;
                }
            };
//        listpet.setCellRenderer(renderer);
            listpet.setCellRenderer(new MyRenderer());
            listpet.addMouseListener(new PetJlistChoseMouslisten(listpet, this));
            listpet.addMouseMotionListener(new PetJlistChoseMouslisten(listpet, this));
            // 召唤兽列表滚动条
            jScrollPane = new JScrollPane(listpet);
            jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            jScrollPane.getVerticalScrollBar().setUI(new SrcollPanelUI());
            jScrollPane.getViewport().setOpaque(false);
            jScrollPane.setOpaque(false);
            jScrollPane.setBounds(50, 40, 166, 136);
            jScrollPane.setBorder(BorderFactory.createEmptyBorder());
            jScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(jScrollPane);

            labNedan = new NeidanBtn[Integer.parseInt(configure.getNdslsx())];

            for (int i = 0; i < Integer.parseInt(configure.getNdslsx()); i++) {
                labNedan[i] = new NeidanBtn("skin/8100226/button/B161.png", 1, i);
                labNedan[i].setBounds(216, 40 + i * 18, 18, 18);
                this.add(labNedan[i]);
            }

            for (int i = 0; i < dians.length; i++) {
                if (i % 2 == 0) {
                    dians[i] = new CharacterBtn("skin/8100226/button/12.png", 1, 10 + i);
                } else {
                    dians[i] = new CharacterBtn("skin/8100226/button/11.png", 1, 10 + i);
                }
                dians[i].setBounds(349 + i % 2 * 14, 297 + i / 2 * 25, 12, 16);
                dians[i].addMouseListener(new PointChangeMouslisten(i + 10));
                this.add(dians[i]);
            }

            Font font = new Font("微软雅黑", 1, 14);
            // 名称
            labname = new JTextField();
            labname.setBounds(81, 193, 99, 18);
            labname.setForeground(Color.white);
            labname.setOpaque(false);
            labname.setBorder(BorderFactory.createEmptyBorder());
            labname.setFont(font);
            labname.setCaretColor(Color.white);
            this.add(labname);

            // 等级
            lablevel = new JLabel();
            lablevel.setBounds(81, 221, 99, 15);
            lablevel.setForeground(Color.WHITE);
            lablevel.setFont(font);
            this.add(lablevel);

            // 忠诚
            labloyalty = new JLabel();
            labloyalty.setBounds(81, 247, 99, 15);
            labloyalty.setForeground(Color.WHITE);
            labloyalty.setFont(font);
            this.add(labloyalty);

            // 亲密
            labclose = new JLabel();
            labclose.setBounds(81, 271, 99, 15);
            labclose.setForeground(Color.WHITE);
            labclose.setFont(font);
            this.add(labclose);

            // HP
            labHP = new JLabel();
            labHP.setBounds(81, 297, 135, 15);
            labHP.setForeground(Color.WHITE);
            labHP.setFont(font);
            this.add(labHP);

            // MP
            labMP = new JLabel();
            labMP.setBounds(81, 322, 135, 15);
            labMP.setForeground(Color.WHITE);
            labMP.setFont(font);
            this.add(labMP);

            // AP
            labAP = new JLabel();
            labAP.setBounds(81, 346, 135, 15);
            labAP.setForeground(Color.WHITE);
            labAP.setFont(font);
            this.add(labAP);

            // SP
            labSP = new JLabel();
            labSP.setBounds(81, 372, 135, 15);
            labSP.setForeground(Color.WHITE);
            labSP.setFont(font);
            this.add(labSP);

            // 禅定
            labCP = new JLabel("135");
            labCP.setBounds(81, 399, 135, 15);
            labCP.setForeground(Color.WHITE);
            labCP.setFont(font);
            this.add(labCP);

            // EXP
            labEXP = new JLabel();
            labEXP.setBounds(81, 422, 135, 15);
            labEXP.setForeground(Color.WHITE);
            labEXP.setFont(new Font("微软雅黑", 1, 12));
            this.add(labEXP);

            // 根骨
            labrootbone = new JLabel();
            labrootbone.setBounds(272, 297, 60, 15);
            labrootbone.setForeground(Color.WHITE);
            labrootbone.setFont(font);
            this.add(labrootbone);

            // 灵性
            labintelligence = new JLabel();
            labintelligence.setBounds(272, 322, 60, 15);
            labintelligence.setForeground(Color.WHITE);
            labintelligence.setFont(font);
            this.add(labintelligence);

            // 力量
            labpower = new JLabel();
            labpower.setBounds(272, 346, 60, 15);
            labpower.setForeground(Color.WHITE);
            labpower.setFont(font);
            this.add(labpower);

            // 敏捷
            labspeed = new JLabel();
            labspeed.setBounds(272, 372, 60, 15);
            labspeed.setForeground(Color.WHITE);
            labspeed.setFont(font);
            this.add(labspeed);

            // 定力
            labconcentrate = new JLabel("0");
            labconcentrate.setBounds(272, 398, 60, 15);
            labconcentrate.setForeground(Color.WHITE);
            labconcentrate.setFont(font);
            this.add(labconcentrate);

            // 可分配点数
            labpointnumber = new JLabel();
            labpointnumber.setBounds(325, 271, 40, 15);
            labpointnumber.setForeground(Color.WHITE);
            labpointnumber.setFont(font);
            this.add(labpointnumber);
            btnpalPet = new PetPanelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "分配", 110,
                    this);
            btnpalPet.setBounds(234, 20, 36, 18);
            Configure configure4 = item.get(new BigDecimal(17));
            if(configure4.getJumpurl().equals("开")){
                btnpalPet.setVisible(true);
            }else{
                btnpalPet.setVisible(false);
            }
            this.add(btnpalPet);
            // 排序
            supportListBtn = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "排", 22,
                    this);
            supportListBtn.setBounds(194, 20, 18, 18);
            this.add((Component)this.supportListBtn);
            //存
            btnpetyc = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "存", 24,
                    this);
            btnpetyc.setBounds(272, 20, 18, 18);
            this.add(btnpetyc);
            //取
            btnpetyc = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "取", 23,
                    this);
            btnpetyc.setBounds(272 + 22, 20, 18, 18);
            this.add(btnpetyc);
            //宠物跟随观看
            btnpetgk = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "观", 20,
                    this);
//        btnpetgk.setBounds(260+22*2, 20, 18, 18);
            btnpetgk.setBounds(216, 135 + 22, 18, 18);
            this.add(btnpetgk);
            //宠物观看隐藏
            btnpetyc = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "隐", 21,
                    this);
//        btnpetyc.setBounds(260+22*3, 20, 18, 18);
            btnpetyc.setBounds(216, 135, 18, 18);
            this.add(btnpetyc);


            // 召唤兽加锁按钮
            btnlock = new GoodAndPetLockBtn("skin/8100226/newbutton/K156.png", 1, 3);
            btnlock.setBounds(216, 135, 18, 18);
            btnlock.setBounds(272 + 22 * 2, 20, 18, 18);
            this.add(btnlock);

            // 召唤兽加锁按钮
            btnunlock = new GoodAndPetLockBtn("skin/8100226/newbutton/K157.png", 1, 4);
            btnunlock.setBounds(216, 135+22, 18, 18);
            this.btnunlock.setBounds(272 + 22 * 3, 20, 18, 18);
            this.add(btnunlock);

//            btnTime = new GoodAndPetLockBtn("inkImg/old/pack/smTime.png", 1,1);
//            btnTime.setBounds(260 + 22 * 2, 20, 18, 18);
//            this.add(btnTime);
//
//            // 修改密码按钮
//            (this.btnchangepwd = new GoodPanelBtn("skin/8100226/newbutton/B31.png", 1,
//                    "设","",""))
//                    .addMouseListener((MouseListener)new WLLMouslisten(24));
////				this.btnchangepwd.setBounds(219, 180, 18, 18);
//            this.btnchangepwd.setBounds(260 + 22 * 3, 20, 18, 18);
//            this.add((Component)this.btnchangepwd);


            // 修改名称按钮
            btnpetnamech = new PetPanelBtn("skin/8100226/newbutton/B31.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "改", 1,
                    this);
            btnpetnamech.setBounds(193, 194, 18, 18);
            this.add(btnpetnamech);
            // 驯养按钮
            btndomesticated = new PetPanelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "驯养", 5,
                    this);
            btndomesticated.setBounds(177, 245, 34, 17);
            this.add(btndomesticated);
            // 放生宠物按钮
            btnrelease = new PetPanelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "放生", 9, this);
            btnrelease.setBounds(177, 219, 34, 17);
            this.add(btnrelease);

            // 灵犀按钮
            lingxi = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY88, "灵犀", 601, this);
            lingxi.setBounds(235, 241, 59, 24);
//    		this.add(lingxi);
            lingxi.setVisible(false);

            btnlh = new PetPanelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "炼魂", 112,
                    this);
            btnlh.setBounds(236, 218, 36, 18);
            btnlh.setVisible(false);
            if(configure.getPethun().equals("开")){
                btnlh.setVisible(true);
            }else{
                btnlh.setVisible(false);
            }
            this.add(btnlh);
            btnjp = new PetPanelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "聚魄", 113,
                    this);
            btnjp.setBounds(341, 218, 36, 18);
            if(configure.getPethun().equals("开")){
                btnjp.setVisible(true);
            }else{
                btnjp.setVisible(false);
            }
            this.add(btnjp);
            // 参战按钮
            btnwar = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "参战", 2, this);
            btnwar.setBounds(315, 241, 59, 24);
            this.add(btnwar);

            // 加点按钮
            btnaddlittle = new PetPanelBtn("skin/8100226/newbutton/B32.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "确认加点", 4,
                    this);
            btnaddlittle.setBounds(260, 398, 51, 17);
            this.add(btnaddlittle);

            // 宠物物品按钮
            btnpetarticles = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "物品",
                    7, this);
            btnpetarticles.setBounds(25 + 11 + 14 - 15, 460 - 12, 59, 24);
            this.add(btnpetarticles);
            // 宠物炼妖按钮
            btnsmeltmonster = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "炼妖",
                    8, this);
            btnsmeltmonster.setBounds(89 + 15 + 27 - 15, 460 - 12, 59, 24);
            this.add(btnsmeltmonster);
            // 召唤按钮
            //   btnsummon = new PetPanelBtn(imageMap.getImgMap().get("B20"),"B20", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "召唤", 11,
            //        this);
            //   btnsummon.setBounds(146 + 19, 460 - 8, 59, 24);
            //  this.add(btnsummon);
            // 抗性按钮
            btnRolequality = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "抗性",
                    10, this);
            btnRolequality.setBounds(213 - 15, 460 - 12, 59, 24);
            this.add(btnRolequality);
            // 宠物技能按钮
            btnpetkills = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "技能", 6,
                    this);
            btnpetkills.setBounds(281 + 13 - 15, 460 - 12, 59, 24);
            this.add(btnpetkills);

//            handbook = new PetPanelBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_BTNPUTONG, UIUtils.TEXT_FONT2, "图鉴", 114, this);
//            handbook.setBounds(281, 460 - 12, 59, 24);
//            this.add(handbook);
            // 召唤兽数量
//        (TestPetJpanel.petsum = new JLabel()).setForeground(new Color(187, 165, 75));
            (TestPetJpanel.petsum = new JLabel()).setForeground(Color.WHITE);
            TestPetJpanel.petsum.setFont(new Font("仿宋", 1, 15));
            this.add((Component) TestPetJpanel.petsum);
            btnhuanfu = new PetPanelBtn("inkImg/button/幻肤1.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "", 111, this);
            btnhuanfu.addMouseListener(new WLLMouslisten(76));
            btnhuanfu.setBounds(335, 40, 38, 32);
            Configure configure1 = item.get(new BigDecimal(17));
            if(configure1.getZqsld().equals("开")){
                btnhuanfu.setVisible(true);
            }else{
                btnhuanfu.setVisible(false);
            }
            this.add(btnhuanfu);

            shengxinBtn = new PetEquipmentBtn("inkImg/button/升星.png", 1, "", 2);
            shengxinBtn.addMouseListener(new WLLMouslisten(78));
            shengxinBtn.setBounds(238, 40, 38, 32);
            Configure configure2 = item.get(new BigDecimal(17));
            if(configure2.getNdslsx().equals("开")){
                shengxinBtn.setVisible(true);
            }else{
                shengxinBtn.setVisible(false);
            }
            this.add(shengxinBtn);
            // 召唤兽分解按钮
            salvagebtn = new PetPanelBtn("inkImg/button/分解.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "", 17, this);
            salvagebtn.addMouseListener(new WLLMouslisten(77));
            salvagebtn.setBounds(286, 40, 38, 32);
            salvagebtn.addMouseListener(new WLLMouslisten(110));
            Configure configure3 = item.get(new BigDecimal(17));
            if(configure3.getLyssx().equals("开")){
                salvagebtn.setVisible(true);
            }else{
                salvagebtn.setVisible(false);
            }
            this.add(salvagebtn);
        } else {
            this.add(this.getChangeImg());
            testPetJpanel = this;
            this.setPreferredSize(new Dimension(356, 517));
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            this.setLayout(null);
            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/1/s74.png", 1, 6);
            offBtn.setBounds(333, 2, 23, 23);
            this.add(offBtn);
            listModel = new DefaultListModel<String>();
            // 召唤兽列表
            listpet = new JList<String>() {
                {
                    setOpaque(false);
                } // instance initializer
            };
            listpet.setSelectionBackground(new Color(33, 42, 52));
            fontcolor = Color.white;// 203,181,91
            listpet.setSelectionForeground(fontcolor);
            listpet.setForeground(fontcolor);
            listpet.setFont(new Font("微软雅黑", 1, 14));
            listpet.setBackground(UIUtils.Color_BACK); // 设置列表框为透明背景
            listpet.setModel(listModel);
            listpet.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            DefaultListCellRenderer renderer = new DefaultListCellRenderer() {
                Color color = new Color(203, 181, 91);

                @Override
                public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
                                                              boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (warNum == index) {
                        this.setForeground(color);
                    } else {
                        this.setForeground(Color.white);
                    }
                    return this;
                }
            };
//        listpet.setCellRenderer(renderer);
            listpet.setCellRenderer(new MyRenderer());
            listpet.addMouseListener(new PetJlistChoseMouslisten(listpet, this));
            listpet.addMouseMotionListener(new PetJlistChoseMouslisten(listpet, this));
            // 召唤兽列表滚动条
            jScrollPane = new JScrollPane(listpet);
            jScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            jScrollPane.getVerticalScrollBar().setUI(new ScrollUI());
            jScrollPane.getViewport().setOpaque(false);
            jScrollPane.setOpaque(false);
            jScrollPane.setBounds(25, 55, 145, 132);
            jScrollPane.setBorder(BorderFactory.createEmptyBorder());
            jScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(jScrollPane);

            labNedan = new NeidanBtn[Integer.parseInt(configure.getNdslsx())];

            for (int i = 0; i < Integer.parseInt(configure.getNdslsx()); i++) {
                labNedan[i] = new NeidanBtn("inkImg/hongmu/2/4_png.button.btn_pet_bar.png", 1, i);
                labNedan[i].setBounds(178, 62 + i * 18, 15, 15);
                this.add(labNedan[i]);
            }

            for (int i = 0; i < dians.length; i++) {
                if (i % 2 == 0) {
                    dians[i] = new CharacterBtn("inkImg/hongmu/2/26_png.button.btn_left.png", 1, 10 + i);
                } else {
                    dians[i] = new CharacterBtn("inkImg/hongmu/2/54_png.button.btn_right.png", 1, 10 + i);
                }
                dians[i].setBounds(305 + i % 2 * 13, 313 + i / 2 * 25, 13, 13);
                dians[i].addMouseListener(new PointChangeMouslisten(i + 10));
                this.add(dians[i]);
            }

            Font font = new Font("微软雅黑", 1, 14);
            // 名称
            labname = new JTextField();
            labname.setBounds(59, 208, 99, 18);
            labname.setForeground(Color.white);
            labname.setOpaque(false);
            labname.setBorder(BorderFactory.createEmptyBorder());
            labname.setFont(font);
            labname.setCaretColor(Color.white);
            this.add(labname);

            // 等级
            lablevel = new JLabel();
            lablevel.setBounds(59, 234, 99, 15);
            lablevel.setForeground(Color.WHITE);
            lablevel.setFont(font);
            this.add(lablevel);

            // 忠诚
            labloyalty = new JLabel();
            labloyalty.setBounds(59, 260, 99, 15);
            labloyalty.setForeground(Color.WHITE);
            labloyalty.setFont(font);
            this.add(labloyalty);

            // 亲密
            labclose = new JLabel();
            labclose.setBounds(59, 286, 120, 15);
            labclose.setForeground(Color.WHITE);
            labclose.setFont(font);
            this.add(labclose);

            // HP
            labHP = new JLabel();
            labHP.setBounds(59, 312, 120, 15);
            labHP.setForeground(Color.WHITE);
            labHP.setFont(font);
            this.add(labHP);

            // MP
            labMP = new JLabel();
            labMP.setBounds(59, 337, 120, 15);
            labMP.setForeground(Color.WHITE);
            labMP.setFont(font);
            this.add(labMP);

            // AP
            labAP = new JLabel();
            labAP.setBounds(59, 362, 120, 15);
            labAP.setForeground(Color.WHITE);
            labAP.setFont(font);
            this.add(labAP);

            // SP
            labSP = new JLabel();
            labSP.setBounds(59, 387, 120, 15);
            labSP.setForeground(Color.WHITE);
            labSP.setFont(font);
            this.add(labSP);

            // 禅定
            labCP = new JLabel("135");
            labCP.setBounds(59, 412, 120, 15);
            labCP.setForeground(Color.WHITE);
            labCP.setFont(font);
            this.add(labCP);

            // EXP
            labEXP = new JLabel();
            labEXP.setBounds(59, 437, 120, 15);
            labEXP.setForeground(Color.WHITE);
            labEXP.setFont(new Font("微软雅黑", 1, 12));
            this.add(labEXP);

            // 根骨
            labrootbone = new JLabel();
            labrootbone.setBounds(238, 312, 60, 15);
            labrootbone.setForeground(Color.WHITE);
            labrootbone.setFont(font);
            this.add(labrootbone);

            // 灵性
            labintelligence = new JLabel();
            labintelligence.setBounds(238, 337, 60, 15);
            labintelligence.setForeground(Color.WHITE);
            labintelligence.setFont(font);
            this.add(labintelligence);

            // 力量
            labpower = new JLabel();
            labpower.setBounds(238, 362, 60, 15);
            labpower.setForeground(Color.WHITE);
            labpower.setFont(font);
            this.add(labpower);

            // 敏捷
            labspeed = new JLabel();
            labspeed.setBounds(238, 387, 60, 15);
            labspeed.setForeground(Color.WHITE);
            labspeed.setFont(font);
            this.add(labspeed);

            // 定力
            labconcentrate = new JLabel("0");
            labconcentrate.setBounds(238, 412, 60, 15);
            labconcentrate.setForeground(Color.WHITE);
            labconcentrate.setFont(font);
            this.add(labconcentrate);

            // 可分配点数
            labpointnumber = new JLabel();
            labpointnumber.setBounds(290, 286, 40, 15);
            labpointnumber.setForeground(Color.WHITE);
            labpointnumber.setFont(font);
            this.add(labpointnumber);

            btnpalPet = new PetPanelBtn("inkImg/hongmu/1/ss531.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "分配", 110,
                    this);
            btnpalPet.setBounds(207, 33, 36, 18);
            Configure configure4 = item.get(new BigDecimal(17));
            if(configure4.getJumpurl().equals("开")){
                btnpalPet.setVisible(true);
            }else{
                btnpalPet.setVisible(false);
            }
            this.add(btnpalPet);
            // 排序
            supportListBtn = new PetPanelBtn("inkImg/hongmu/1/btn-small-1-bg.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "排", 22,
                    this);
            supportListBtn.setBounds(154, 32, 18, 18);
            this.add((Component)this.supportListBtn);
            //存
            btnpetyc = new PetPanelBtn("inkImg/hongmu/1/btn-small-1-bg.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "存", 24,
                    this);
            btnpetyc.setBounds(228 + 19, 20 + 13, 19, 19);
            this.add(btnpetyc);
            //取
            btnpetyc = new PetPanelBtn("inkImg/hongmu/1/btn-small-1-bg.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "取", 23,
                    this);
            btnpetyc.setBounds(228 + 21*2, 20 + 13, 19, 19);
            this.add(btnpetyc);
            //宠物跟随观看
            btnpetgk = new PetPanelBtn("inkImg/hongmu/1/btn-small-1-bg.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "观", 20,
                    this);
//        btnpetgk.setBounds(260+22*2, 20, 18, 18);
            btnpetgk.setBounds(177, 135 + 22 + 10, 19, 19);
            this.add(btnpetgk);
            //宠物观看隐藏
            btnpetyc = new PetPanelBtn("inkImg/hongmu/1/btn-small-1-bg.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "隐", 21,
                    this);
//        btnpetyc.setBounds(260+22*3, 20, 18, 18);
            btnpetyc.setBounds(177, 135 + 10, 19, 19);
            this.add(btnpetyc);


            // 召唤兽加锁按钮
            this.btnlock = new GoodAndPetLockBtn("inkImg/hongmu/2/24_png.button.btn_lock.png", 1, 3);
            btnlock.setBounds(216, 135, 18, 18);
            btnlock.setBounds(228 + 22 * 3, 33, 18, 18);
            this.add(btnlock);

            // 召唤兽解锁按钮
            this.btnunlock = new GoodAndPetLockBtn("inkImg/hongmu/2/27_png.button.btn_unlock.png", 1, 4);
            btnunlock.setBounds(216, 135+22, 18, 18);
            this.btnunlock.setBounds(228 + 22 * 4 , 33, 18, 18);
            this.add(btnunlock);
//            // 召唤兽解锁按钮
//            btnTime = new GoodAndPetLockBtn("inkImg/old/pack/hmTime.png", 1,1);
//            btnTime.setBounds(228 + 22 * 2, 32, 18, 18);
//            this.add(btnTime);
//
//            // 修改密码按钮
//            (this.btnchangepwd = new GoodPanelBtn("inkImg/hongmu/1/B31h.png", 1,
//                    "设","",""))
//                    .addMouseListener((MouseListener)new WLLMouslisten(24));
//            this.btnchangepwd.setBounds(228 + 22 * 3 , 32, 18, 18);
//            this.add((Component)this.btnchangepwd);


            // 修改名称按钮
            btnpetnamech = new PetPanelBtn("inkImg/hongmu/soaring/改w17,h51px.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "改", 1,
                    this);
            btnpetnamech.setBounds(158, 209, 17, 17);
            this.add(btnpetnamech);
            // 驯养按钮
            btndomesticated = new PetPanelBtn("inkImg/hongmu/soaring/驯养w34,h51px.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "驯养", 5,
                    this);
            btndomesticated.setBounds(144, 260, 34, 17);
            this.add(btndomesticated);
            // 放生宠物按钮
            btnrelease = new PetPanelBtn("inkImg/hongmu/soaring/放生w34,h51px.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "放生", 9, this);
            btnrelease.setBounds(144, 234, 34, 17);
            this.add(btnrelease);

            // 灵犀按钮
            lingxi = new PetPanelBtn("inkImg/hongmu/1/50x50.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "灵犀", 601, this);
//            lingxi.setBounds(210, 251, 50, 30);
            lingxi.setBounds(225, 251, 50, 30);
//    		this.add(lingxi);
            lingxi.setVisible(false);

            btnlh = new PetPanelBtn("inkImg/hongmu/1/ss531.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "炼魂", 112,
                    this);
            btnlh.setBounds(198, 233, 36, 18);
            if(configure.getPethun().equals("开")){
                btnlh.setVisible(true);
            }else{
                btnlh.setVisible(false);
            }
            this.add(btnlh);
            btnjp = new PetPanelBtn("inkImg/hongmu/1/ss531.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_FONT2, "聚魄", 113,
                    this);
            btnjp.setBounds(302, 233, 36, 18);
            if(configure.getPethun().equals("开")){
                btnjp.setVisible(true);
            }else{
                btnjp.setVisible(false);
            }
            this.add(btnjp);
            // 参战按钮
            btnwar = new PetPanelBtn("inkImg/hongmu/1/50x50.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY88, "参战", 2, this);
            btnwar.setBounds(280, 251, 50, 30);
            this.add(btnwar);

            // 加点按钮
            btnaddlittle = new PetPanelBtn("inkImg/hongmu/soaring/确认加点w68,h51px.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT2, "", 4,
                    this);
            btnaddlittle.setBounds(270, 437, 68, 17);
            this.add(btnaddlittle);

            // 宠物物品按钮
            btnpetarticles = new PetPanelBtn("inkImg/hongmu/1/60_26.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "物品",
                    7, this);
            btnpetarticles.setBounds(50 - 24, 460 + 5, 60, 26);
            this.add(btnpetarticles);
            // 宠物炼妖按钮
            btnsmeltmonster = new PetPanelBtn("inkImg/hongmu/1/60_26.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "炼妖",
                    8, this);
            btnsmeltmonster.setBounds(131 - 24, 460 + 5, 60, 26);
            this.add(btnsmeltmonster);
            // 召唤按钮
            //   btnsummon = new PetPanelBtn(imageMap.getImgMap().get("B20"),"B20", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "召唤", 11,
            //        this);
            //   btnsummon.setBounds(146 + 19, 460 - 8, 59, 24);
            //  this.add(btnsummon);
            // 抗性按钮
            btnRolequality = new PetPanelBtn("inkImg/hongmu/1/60_26.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "抗性",
                    10, this);
            btnRolequality.setBounds(213 - 24, 460 + 5, 60, 26);
            this.add(btnRolequality);
            // 宠物技能按钮
            btnpetkills = new PetPanelBtn("inkImg/hongmu/1/60_26.png", 1, UIUtils.COLOR_BTNPUTONG2, UIUtils.TEXT_HY16, "技能", 6,
                    this);
            btnpetkills.setBounds(294 - 24, 460 + 5, 60, 26);
            this.add(btnpetkills);

            // 召唤兽数量
//        (TestPetJpanel.petsum = new JLabel()).setForeground(new Color(187, 165, 75));
            (TestPetJpanel.petsum = new JLabel()).setForeground(new Color(147, 165, 75));
            TestPetJpanel.petsum.setFont(new Font("仿宋", 1, 14));
            this.add((Component) TestPetJpanel.petsum);

            btnhuanfu = new PetPanelBtn("inkImg/button/幻肤1.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "", 111, this);//红木
            btnhuanfu.addMouseListener(new WLLMouslisten(76));
            btnhuanfu.setBounds(295, 57, 38, 22);
            Configure configure1 = item.get(new BigDecimal(17));
            if(configure1.getZqsld().equals("开")){
                btnhuanfu.setVisible(true);
            }else{
                btnhuanfu.setVisible(false);
            }
            this.add(btnhuanfu);

            shengxinBtn = new PetEquipmentBtn("inkImg/button/升星.png", 1, "", 2);//红木
            shengxinBtn.addMouseListener(new WLLMouslisten(78));
            shengxinBtn.setBounds(200, 57, 38, 22);
            Configure configure2 = item.get(new BigDecimal(17));
            if(configure2.getNdslsx().equals("开")){
                shengxinBtn.setVisible(true);
            }else{
                shengxinBtn.setVisible(false);
            }
            this.add(shengxinBtn);
            // 召唤兽分解按钮
            salvagebtn = new PetPanelBtn("inkImg/button/分解.png", 1, UIUtils.COLOR_BTNTEXT, UIUtils.TEXT_FONT, "", 17, this);//红木
            salvagebtn.addMouseListener(new WLLMouslisten(77));
            salvagebtn.setBounds(245, 57, 38, 22);
            salvagebtn.addMouseListener(new WLLMouslisten(110));
            Configure configure3 = item.get(new BigDecimal(17));
            if(configure3.getLyssx().equals("开")){
                salvagebtn.setVisible(true);
            }else{
                salvagebtn.setVisible(false);
            }
            this.add(salvagebtn);
            this.add(salvagebtn);


        }

    }
    public PetPanelBtn btnhuanfu;//幻肤
    public PetPanelBtn salvagebtn;//分解
    public PetEquipmentBtn shengxinBtn;//升星
    /**
     * 0-4 获取根骨灵性力量敏捷可分配点
     */
    public int getdian(int type) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone.getText());
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence.getText());
            } else if (type == 2) {
                type = Integer.parseInt(labpower.getText());
            } else if (type == 3) {
                type = Integer.parseInt(labspeed.getText());
            } else if (type == 4) {
                type = Integer.parseInt(labconcentrate.getText());
            } else if (type == 5) {
                type = Integer.parseInt(labpointnumber.getText());
            }
        } catch (Exception e) {
            // TODO: handle exception
            type = 0;
        }
        return type;
    }

    /**
     * 0-4 点数变化根骨灵性力量敏捷可分配点
     */
    public void adddian(int type, int point) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone.getText());
                labrootbone.setText(type + point + "");
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence.getText());
                labintelligence.setText(type + point + "");
            } else if (type == 2) {
                type = Integer.parseInt(labpower.getText());
                labpower.setText(type + point + "");
            } else if (type == 3) {
                type = Integer.parseInt(labspeed.getText());
                labspeed.setText(type + point + "");
            } else if (type == 4) {
                type = Integer.parseInt(labconcentrate.getText());
                labconcentrate.setText(type + point + "");
            }
            type = Integer.parseInt(labpointnumber.getText());
            labpointnumber.setText(type - point + "");
        } catch (Exception e) {
            // TODO: handle exception
        }
    }


    public static void showStar() {
        petOrder();
        int i;
        if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null) {//空
            listModel.removeAllElements();//去除
            for (i = 0; i < UserMessUntil.getPetListTable().size(); ++i) {// 召唤兽信息list

                // 放置召唤兽的对象(召唤兽+召唤兽名字)
                listModel.add(i, UserMessUntil.getPetListTable().get(i).getSummoningname());
                if (RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) == 0) {//点击参战后
                    listModel.set(i, "( * )" + UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                }
                if (UserMessUntil.getPetListTable().get(i).isShow()) {//点击观看后
                    listModel.set(i, UserMessUntil.getPetListTable().get(i).getSummoningname()+"(观)");//召唤兽名字
                } else if (!UserMessUntil.getPetListTable().get(i).isShow() && RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) != 0) {
                    listModel.set(i, UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                }
            }
        } else {
            listModel.removeAllElements();
            for (i = 0; i < UserMessUntil.getPetListTable().size(); ++i) {
                listModel.add(i, UserMessUntil.getPetListTable().get(i).getSummoningname());
            }
        }
    }


    private static void petOrder() {
        //重新排序
        List<RoleSummoning> roleSummonings =  UserMessUntil.getPetListTable();
        RoleData.getRoleData().addOrderPet(roleSummonings);
        RoleData roleData = RoleData.getRoleData();
        List<BigDecimal> petOrder = roleData.getPetOrder();
        List<RoleSummoning> newRoleSummonings = new ArrayList<>();
        for (int i = 0; i < petOrder.size(); i++) {
            RoleSummoning pet = UserMessUntil.getPetRgid(petOrder.get(i));
            if (pet != null) {
                newRoleSummonings.add(pet);
            }
        }
        UserMessUntil.setPetListTable(newRoleSummonings);
        if (PetpxJframe.getPetpxJframe().isVisible()) {
            PetpxJframe.getPetpxJframe().getPetpxJpanel().init(roleData.getOrderPetName());
        }
    }

    public static void showListModel(List<RoleSummoning> pets, BigDecimal petid) {
        petOrder();
        listModel.removeAllElements();
        warNum = -1;

        for (int i = 0, length = pets.size(); i < length; i++) {
            RoleSummoning pet = pets.get(i);
            if (petid != null && petid.compareTo(pet.getSid()) == 0) {
                warNum = i;
                listModel.addElement("( * )" + pet.getSummoningname());
            } else {
                listModel.addElement(pet.getSummoningname());
            }
            if (UserMessUntil.getPetListTable().get(i).isShow()) {//点击观看后
                listModel.set(i, "(观)" + UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
            } else if (!UserMessUntil.getPetListTable().get(i).isShow()) {
                if (UserMessUntil.getPetListTable().get(i).getSid() != null) {
                    if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null && RoleData.getRoleData().getLoginResult().getSummoning_id().compareTo(UserMessUntil.getPetListTable().get(i).getSid()) != 0) {
                        listModel.set(i, UserMessUntil.getPetListTable().get(i).getSummoningname());//召唤兽名字
                    }
                }
            }
        }
    }

//
//    public static void showStar() {
//        warNum = listpet.getSelectedIndex();
//        // 判断如果有参战召唤兽,这只召唤兽的前面就加个(*)
//        if (RoleData.getRoleData().getLoginResult().getSummoning_id() != null && warNum != -1) {
//            String name = listModel.getElementAt(warNum);
//            listModel.remove(warNum);
//            listModel.add(warNum, "( * )"+name);
//            listpet.setSelectedIndex(warNum);
//
//            for (int i = 0,length =listModel.size(); i < length; i++) {
//                name = listModel.getElementAt(i);
//                if (warNum != i && name.startsWith("* ")) {
//                    listModel.remove(i);
//                    listModel.add(i,name.substring(2));
//                }
//            }
//        }
//    }


    /**
     * 飞升前和飞升后的界面切换
     *
     * @param lvltrue <=3没有飞升 >3飞升
     */
    public void changeSoaringPanel(int lvltrue) {
        level = lvltrue;
        if (lvltrue <= 3) {// 没有飞升
            // 隐藏飞升后才有的功能
            dians[8].setVisible(false);
            dians[9].setVisible(false);
            labconcentrate.setVisible(false);
            labCP.setVisible(false);
            if (MyIsif.getStyle().equals("水墨UI")) {
                labEXP.setBounds(81, 399, 135, 15);
                btnaddlittle.setBounds(310, 398, 51, 17);
                icon = CutButtonImage.getImage("inkImg/newbackground/B100.png", -1, -1);
            } else {
                labEXP.setBounds(59, 412, 120, 15);
                this.btnaddlittle.setBounds(250, 412, 68, 17);
                this.icon = CutButtonImage.getImage("inkImg/hongmu/soaring/召唤兽(无飞升)w356,h517px.png", -1, -1);
            }
        } else {// 飞升
            // 展示飞升才有的功能
            dians[8].setVisible(true);
            dians[9].setVisible(true);
            labconcentrate.setVisible(true);
            labCP.setVisible(true);
            lingxi.setVisible(true);
            this.add(lingxi);
            if (MyIsif.getStyle().equals("水墨UI")) {
                labEXP.setBounds(81, 425, 135, 15);
                btnaddlittle.setBounds(310, 425, 51, 17);
                icon = CutButtonImage.getImage("inkImg/newbackground/B105.png", -1, -1);
            } else {
                labEXP.setBounds(59, 437, 120, 15);
                this.btnaddlittle.setBounds(250, 437, 68, 17);
                this.icon = CutButtonImage.getImage("inkImg/hongmu/soaring/召唤兽w356,h517px.png", -1, -1);
            }
        }

    }


    public static NewPart part;

    private ImageIcon sm_iconLessLevel3 = new ImageIcon( "inkImg/newbackground/B100.png");

    private ImageIcon sm_iconGrate1Level3 = new ImageIcon( "inkImg/newbackground/B105.png");

    private ImageIcon hm_iconLessLevel3 = new ImageIcon("inkImg/hongmu/soaring/召唤兽(无飞升)w356,h517px.png");

    private ImageIcon hm_iconGrate1Level3 = new ImageIcon("inkImg/hongmu/soaring/召唤兽w356,h517px.png");

    int sun;
    Graphics2D graphics2d;
    ConfigureBean allConfigure;
    Map<BigDecimal, Configure> item;
    Configure configure;
    RoleSummoning pet;

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        // 召唤兽数量
        sun = UserMessUntil.getPetListTable().size();
//        TestPetJpanel.petsum.setText("(" + sun + "/" + RoleData.getRoleData().getPackRecord().getPettNum() + ")");
        TestPetJpanel.petsum.setText("召唤兽" + "(" + sun + "/" + 30 + ")");

        graphics2d = (Graphics2D) g;
//        if (icon == null)
        if (MyIsif.getStyle().equals("水墨UI")) {
            if (level <= 3) {
                // 召唤兽数量
                TestPetJpanel.petsum.setBounds(75, 23, 135, 15);
                // 道具栏
                graphics2d.drawImage(this.sm_iconLessLevel3.getImage(), 0, 0, 393, 490, this);
            } else {
                // 召唤兽数量
                TestPetJpanel.petsum.setBounds(75, 23, 135, 15);
                // 道具栏
                graphics2d.drawImage(this.sm_iconGrate1Level3.getImage(), 0, 0, 393, 490, this);
            }

        } else {

            if (level <= 3) {

                // 召唤兽数量
                TestPetJpanel.petsum.setBounds(50, 37, 135, 15);
                // 道具栏
                graphics2d.drawImage(this.hm_iconLessLevel3.getImage(), 0, 0, 356, 517, this);
            } else {

                // 召唤兽数量
                TestPetJpanel.petsum.setBounds(50, 37, 135, 15);
                // 道具栏
                graphics2d.drawImage(this.hm_iconGrate1Level3.getImage(), 0, 0, 356, 517, this);
            }

        }


        pet = UserMessUntil.getChosePetMes();
        if (pet != null) {
            if (part == null) {
                part = pet.getPart();
            }
            if (part != null) {
                if (MyIsif.getStyle().equals("水墨UI")) {
                    part.draw(graphics2d, 305, 225, 0, ImageMixDeal.userimg.getTime());
                } else {
                    part.draw(graphics2d, 260, 225, 0, ImageMixDeal.userimg.getTime());
                }
            }
            // 如果这只召唤兽有加锁
            if (pet.getPetlock() == 1) {
                GoodsListFromServerUntil.drawPetLock(graphics2d, pet);
            }
        }
        allConfigure = UserMessUntil.getConfigureBean();
        item = allConfigure.getAllConfigure();
        configure = item.get(new BigDecimal(1));
        if (listModel.size() <= 0) {
            for (int i = 0; i < Integer.parseInt(configure.getNdslsx()); i++) {
                labNedan[i].setIcon(null);
            }
        }
        //消除文字锯齿
        graphics2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        //消除画图锯齿
        graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//        btnlh.setBounds(207, 33, 36, 18);
//        btnjp.setBounds(207, 33, 36, 18);
    }


    private void timeLockString(Long milliseconds, Graphics g) {


        long between = 0;
        between = milliseconds - System.currentTimeMillis();// 得到两者的毫秒数
        long day = between / (24 * 60 * 60 * 1000);
        long hour = (between / (60 * 60 * 1000) - day * 24);
        long min = ((between / (60 * 1000)) - day * 24 * 60 - hour * 60);
        long s = (between / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
//        long ms = (between - day * 24 * 60 * 60 * 1000 - hour * 60 * 60 * 1000
//                - min * 60 * 1000 - s * 1000);
        if (Xy2Util.interfaceConfig == 1) {
            g.setColor(Color.red);
            g.drawString("保护时间", 200, 90);
            g.setColor(Color.red);
            g.setColor(Color.YELLOW);
            g.drawString(day + "天" + hour + "小时" + min + "分", 250, 90);
        } else if (Xy2Util.interfaceConfig == 2) {
            g.setColor(Color.red);
            g.drawString("保护时间", 225, 90);
            g.setColor(Color.red);
            g.setColor(Color.YELLOW);
            g.drawString(day + "天" + hour + "小时" + min + "分", 275, 90);
        } else if (Xy2Util.interfaceConfig == 3) {
            g.setColor(Color.red);
            g.drawString("保护时间", 200, 90);
            g.setColor(Color.red);
            g.setColor(Color.YELLOW);
            g.drawString(day + "天" + hour + "小时" + min + "分", 250, 90);
        }
    }

    public void init(final List<String> list) {
        TestPetJpanel.listModel.clear();
        final Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            final String s = (String) iterator.next();
            TestPetJpanel.listModel.addElement(s);
        }
    }

    //时间锁到期判断
    private Boolean isTimeLockOut(Long milliseconds) {
        long nd = 1000 * 24 * 60 * 60 * 7; // 一天的毫秒数
        milliseconds += milliseconds;
        if (System.currentTimeMillis() >= milliseconds) {
            return true;
        }
        return false;
    }

    public static int idx = -1;

    // 初始列表
    public void initS(List<String> list) {
        listModel.clear();
        for (int i = 0; i < list.size(); i++) {
            listModel.addElement(list.get(i));
        }
    }


    @Override
    public void mouseClicked(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mousePressed(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseReleased(MouseEvent e) {

        FormsManagement.HideForm(6);
        // ChosePetMouslisten.setWhether(true);

    }

    @Override
    public void mouseEntered(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub

    }

    public static JList<String> getListpet() {
        return listpet;
    }

    public static void setListpet(JList<String> listpet) {
        TestPetJpanel.listpet = listpet;
    }

    //    public static DefaultListModel<String> getListModel() {
//        return listModel;
//    }
//
//    public static void setListModel(DefaultListModel<String> listModel) {
//        TestPetJpanel.listModel = listModel;
//    }

    public Color getFontcolor() {
        return fontcolor;
    }

    public void setFontcolor(Color fontcolor) {
        this.fontcolor = fontcolor;
    }

    public JScrollPane getjScrollPane() {
        return jScrollPane;
    }

    public void setjScrollPane(JScrollPane jScrollPane) {
        this.jScrollPane = jScrollPane;
    }

    public static JTextField getLabname() {
        return labname;
    }

    public static void setLabname(JTextField labname) {
        TestPetJpanel.labname = labname;
    }

    public static JLabel getLablevel() {
        return lablevel;
    }

    public static void setLablevel(JLabel lablevel) {
        TestPetJpanel.lablevel = lablevel;
    }

    public static JLabel getLabloyalty() {
        return labloyalty;
    }

    public static void setLabloyalty(JLabel labloyalty) {
        TestPetJpanel.labloyalty = labloyalty;
    }

    public static JLabel getLabHP() {
        return labHP;
    }

    public static void setLabHP(JLabel labHP) {
        TestPetJpanel.labHP = labHP;
    }

    public static JLabel getLabMP() {
        return labMP;
    }

    public static void setLabMP(JLabel labMP) {
        TestPetJpanel.labMP = labMP;
    }

    public static JLabel getLabAP() {
        return labAP;
    }

    public static void setLabAP(JLabel labAP) {
        TestPetJpanel.labAP = labAP;
    }

    public static JLabel getLabSP() {
        return labSP;
    }

    public static void setLabSP(JLabel labSP) {
        TestPetJpanel.labSP = labSP;
    }

    public static JLabel getLabEXP() {
        return labEXP;
    }

    public static void setLabEXP(JLabel labEXP) {
        TestPetJpanel.labEXP = labEXP;
    }

    public static JLabel getLabrootbone() {
        return labrootbone;
    }

    public static void setLabrootbone(JLabel labrootbone) {
        TestPetJpanel.labrootbone = labrootbone;
    }

    public static JLabel getLabintelligence() {
        return labintelligence;
    }

    public static void setLabintelligence(JLabel labintelligence) {
        TestPetJpanel.labintelligence = labintelligence;
    }

    public static JLabel getLabpower() {
        return labpower;
    }

    public static void setLabpower(JLabel labpower) {
        TestPetJpanel.labpower = labpower;
    }

    public static JLabel getLabspeed() {
        return labspeed;
    }

    public static void setLabspeed(JLabel labspeed) {
        TestPetJpanel.labspeed = labspeed;
    }

    public static JLabel getLabpointnumber() {
        return labpointnumber;
    }

    public static void setLabpointnumber(JLabel labpointnumber) {
        TestPetJpanel.labpointnumber = labpointnumber;
    }

    public PetPanelBtn getBtnpetnamech() {
        return btnpetnamech;
    }

    public void setBtnpetnamech(PetPanelBtn btnpetnamech) {
        this.btnpetnamech = btnpetnamech;
    }

    public PetPanelBtn getBtnaddlittle() {
        return btnaddlittle;
    }

    public void setBtnaddlittle(PetPanelBtn btnaddlittle) {
        this.btnaddlittle = btnaddlittle;
    }

    public PetPanelBtn getBtndomesticated() {
        return btndomesticated;
    }

    public void setBtndomesticated(PetPanelBtn btndomesticated) {
        this.btndomesticated = btndomesticated;
    }

    public PetPanelBtn getBtnpetkills() {
        return btnpetkills;
    }

    public void setBtnpetkills(PetPanelBtn btnpetkills) {
        this.btnpetkills = btnpetkills;
    }

    public PetPanelBtn getBtnpetarticles() {
        return btnpetarticles;
    }

    public void setBtnpetarticles(PetPanelBtn btnpetarticles) {
        this.btnpetarticles = btnpetarticles;
    }

    public PetPanelBtn getBtnsmeltmonster() {
        return btnsmeltmonster;
    }

    public void setBtnsmeltmonster(PetPanelBtn btnsmeltmonster) {
        this.btnsmeltmonster = btnsmeltmonster;
    }

    public PetPanelBtn getBtnrelease() {
        return btnrelease;
    }

    public void setBtnrelease(PetPanelBtn btnrelease) {
        this.btnrelease = btnrelease;
    }

    public PetPanelBtn getBtnsummon() {
        return btnsummon;
    }

    public void setBtnsummon(PetPanelBtn btnsummon) {
        this.btnsummon = btnsummon;
    }

    public static NeidanBtn[] getLabNedan() {
        return labNedan;
    }

    public static void setLabNedan(NeidanBtn[] labNedan) {
        TestPetJpanel.labNedan = labNedan;
    }

    public static JLabel getLabclose() {
        return labclose;
    }

    public static void setLabclose(JLabel labclose) {
        TestPetJpanel.labclose = labclose;
    }

    public static JLabel getLabCP() {
        return labCP;
    }

    public static void setLabCP(JLabel labCP) {
        TestPetJpanel.labCP = labCP;
    }

    public static JLabel getLabconcentrate() {
        return labconcentrate;
    }

    public static void setLabconcentrate(JLabel labconcentrate) {
        TestPetJpanel.labconcentrate = labconcentrate;
    }

    public PetPanelBtn getBtnwar() {
        return btnwar;
    }

    public void setBtnwar(PetPanelBtn btnwar) {
        this.btnwar = btnwar;
    }

    public PetPanelBtn getLingxi() {
        return lingxi;
    }

    public void setLingxi(PetPanelBtn lingxi) {
        this.lingxi = lingxi;
    }


    public PetPanelBtn getBtnRolequality() {
        return btnRolequality;
    }

    public void setBtnRolequality(PetPanelBtn btnRolequality) {
        this.btnRolequality = btnRolequality;
    }

    public GoodAndPetLockBtn getBtnlock() {
        return btnlock;
    }

    public void setBtnlock(GoodAndPetLockBtn btnlock) {
        this.btnlock = btnlock;
    }

    public GoodAndPetLockBtn getBtnunlock() {
        return btnunlock;
    }

    public void setBtnunlock(GoodAndPetLockBtn btnunlock) {
        this.btnunlock = btnunlock;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public static NewPart getPart() {
        return part;
    }

    public static void setPart(NewPart part) {
        TestPetJpanel.part = part;
    }

    public static TestPetJpanel getTestPetJpanel() {
        return testPetJpanel;
    }

    public static void setTestPetJpanel(TestPetJpanel testPetJpanel) {
        TestPetJpanel.testPetJpanel = testPetJpanel;
    }

    public static int getWarNum() {
        return warNum;
    }

    public static void setWarNum(int warNum) {
        TestPetJpanel.warNum = warNum;
    }

    public JLabel getChangeImg() {
        if (this.changeImg == null) {
            this.changeImg = new JLabel();
            this.changeImg.setOpaque(false);
            this.changeImg.setBounds(194, 66, 158, 218);

        }

        return this.changeImg;
    }

    public void setChangeImg(JLabel changeImg) {
        this.changeImg = changeImg;
    }

    public PetPanelBtn getBtnpetgk() {
        return btnpetgk;
    }

    public void setBtnpetgk(PetPanelBtn btnpetgk) {
        this.btnpetgk = btnpetgk;
    }

    public PetPanelBtn getBtnpetyc() {
        return btnpetyc;
    }

    public void setBtnpetyc(PetPanelBtn btnpetyc) {
        this.btnpetyc = btnpetyc;
    }

    public static JLabel getLabEXPImg() {
        return labEXPImg;
    }


    public static JLabel getPetsum() {
        return TestPetJpanel.petsum;
    }

    public static void setPetsum(final JLabel petsum) {
        TestPetJpanel.petsum = petsum;
    }

    public PetPanelBtn getBtnhuanfu() {
        return btnhuanfu;
    }

    public void setBtnhuanfu(PetPanelBtn btnhuanfu) {
        this.btnhuanfu = btnhuanfu;
    }

    public PetPanelBtn getSalvagebtn() {
        return salvagebtn;
    }

    public void setSalvagebtn(PetPanelBtn salvagebtn) {
        this.salvagebtn = salvagebtn;
    }

    public PetEquipmentBtn getShengxinBtn() {
        return shengxinBtn;
    }

    public void setShengxinBtn(PetEquipmentBtn shengxinBtn) {
        this.shengxinBtn = shengxinBtn;
    }

    public PetPanelBtn getBtnlh() {
        return btnlh;
    }

    public void setBtnlh(PetPanelBtn btnlh) {
        this.btnlh = btnlh;
    }

    public PetPanelBtn getBtnjp() {
        return btnjp;
    }

    public void setBtnjp(PetPanelBtn btnjp) {
        this.btnjp = btnjp;
    }

    /**
     * 重写removeNotify方法，确保清理所有监听器引用
     */
    @Override
    public void removeNotify() {
        // 清理列表监听器
        if (petJlistChoseMouslistenRef != null) {
            PetJlistChoseMouslisten listener = petJlistChoseMouslistenRef.get();
            if (listener != null) {
                listpet.removeMouseListener(listener);
                listpet.removeMouseMotionListener(listener);
            }
            petJlistChoseMouslistenRef = null;
        }

        // 清理点数变化监听器
        if (pointChangeMouslistenRefs != null) {
            for (int i = 0; i < pointChangeMouslistenRefs.length; i++) {
                if (pointChangeMouslistenRefs[i] != null) {
                    PointChangeMouslisten listener = pointChangeMouslistenRefs[i].get();
                    if (listener != null && dians[i] != null) {
                        dians[i].removeMouseListener(listener);
                    }
                    pointChangeMouslistenRefs[i] = null;
                }
            }
            pointChangeMouslistenRefs = null;
        }

        // 调用父类方法
        super.removeNotify();
    }
}

